{% extends 'admin/admin_base.html' %}

{% block title %}
    Blog_mini -欢迎来到Blog_mini管理平台！
{% endblock %}

{% block admin_content %}
<div class="entry-box account">
    <h4><strong><i>{{ current_user.username }}</i>，欢迎来到Blog_mini管理平台！</strong></h4>
    <hr/>
    <div class="user-info">
        <img class="img-rounded profile-thumbnail" src="{{ current_user.gravatar(size=128) }}">
        <div class="profile-header">
            <h5>昵称：</h5>
            <h4 class="username">{{ current_user.username }}</h4>
            <h5>电子邮件：</h5>
            <h4 class="email">{{ current_user.email }}</h4>
            <a class="btn btn-sm btn-danger" onclick="changePassword()">
                修改密码
            </a>
            <a class="btn btn-sm btn-info" onclick="EditUserInfo()">
                修改信息
            </a>
        </div>
    </div>
</div>

<!-- 信息删除确认: For change password form-->
<div class="modal fade" id="changePasswordFormModal">
    <div class="modal-dialog">
        <div class="modal-content message_align">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                        aria-hidden="true">×</span></button>
                <h4 class="modal-title" id="NavModalTitle"></h4>
            </div>
            <form id="changePasswordForm" method="post"
                  action="{{ url_for('admin.change_password') }}">
                <div class="modal-body">
                        <div class="form-group">
                            {{ form.csrf_token }}
                            {{ form.old_password.label }}
                            {{ form.old_password(class='form-control', required='') }}
                            {{ form.password.label }}
                            {{ form.password(class='form-control', required='') }}
                            {{ form.password2.label }}
                            {{ form.password2(class='form-control', required='') }}
                        </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                    <button id="changePasswordCfmClick" type="submit" class="btn btn-success">确定</button>
                </div>
            </form>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->

<!-- 信息删除确认: For edit user info form-->
<div class="modal fade" id="editUserInfoFormModal">
    <div class="modal-dialog">
        <div class="modal-content message_align">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                        aria-hidden="true">×</span></button>
                <h4 class="modal-title" id="NavModalTitle"></h4>
            </div>
            <form id="editUserInfoForm" method="post"
                  action="{{ url_for('admin.edit_user_info') }}">
                <div class="modal-body">
                        <div class="form-group">
                            {{ form2.csrf_token }}
                            {{ form2.username.label }}
                            {{ form2.username(class='form-control', required='', value=current_user.username) }}
                            {{ form2.email.label }}
                            {{ form2.email(class='form-control', required='', value=current_user.email) }}
                            {{ form2.password.label }}
                            {{ form2.password(class='form-control', required='') }}
                        </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                    <button id="editUserInfoCfmClick" type="submit" class="btn btn-success">确定</button>
                </div>
            </form>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
{% endblock %}